He was just yawning. It was just straight up good luck and timing. Also my camera isn't that good. I use a Nikkon coolpix 3200 . You just have to have patience!
In that case you were exceptionally lucky! My dojo loaches would always yawn and lay perfectly still when I didn’t have my camera. Then other times I would sit in front of the tank for longer that I could remember, and all they would be swimming up and down. As if trying to tease me and dare me to put my camera away!