In a game with a rebuy period that ends during a hand, is a player allowed to have the option rebuy after that hand has been completed?
It all depends on the structure of the tournament. To alleviate this issue, many tournaments are scheduled so that the rebuy period ends at a break and after that break no-one can buy back in. Some other tournaments do not include breaks and thus the second the timer is finished for the rebuy period, no-one can buy back in. Obviously, this is the type of ruling that can be totally dependant on the house rules and if you are worried about this, I would advise to ask the floor before the tournament begins.
In addition to ejLev's answer, I'd also add that (in the UK at least), it's very common to reach the end of the rebuy period and then play a set number of additional hands (often 3, but sometimes a random number between 1 and 5) before no further rebuys will be allowed.
I believe the logic behind this is to give players a greater predictability to when the rebuy period will end (relative to hands being played) and so allow them to make better decisions about whether to protect their stack or gamble more with the intention of rebuying if necessary.
This can also work around the problem where the end of rebuys does not coincide with a break, as all tables will wait for every table to complete their last 3 hands (or however many have been announced) before proceeding with play.