Autopilot Pausing in Air

Since you are flying a modified version of the firmware you might be running into stack overflow issues. This causes undefined behavior, i.e. the symptoms are not the same every time. I have seen freezes in mid-air, dead drops (as if disarmed), and uncontrolled position hold behavior, all caused by the same stack overflow in the position control module.

My suggestions:
Have a close look at your stack usage.
Increase the stack size for the module you are working on. Refer to Pixhawk: Stack size in CMakeLists.txt and in px4_task_create()
Can you reproduce this on the firmware version on top of which you are developing you on code?
Did you add print statements? Those can use quite a bit of stack depending on their complexity.