Photocurrent gain mechanisms in metal-semiconductor-metal photodetectors