Prevent roslaunch from SIGKILLing rosbag on completion
I am running a simulation from a roslaunch file. Once the relevant part of the simulation finishes, a required node exits, which prompts roslaunch to terminate all nodes. The simulation is relatively short, but generates a lot of high-resolution images, and so the rosbag record node often can't write to disk in real time, and messages are still in the buffer when the simulation finishes. When roslaunch terminates all nodes, it first sends SIGTERM, which stops rosbag from recording any new messages while it writes the buffer to disk.
All of the above is exactly how I would like it to work. However, after a few seconds, if rosbag has not finished writing to disk, roslaunch escalates to SIGKILL, which immediately kills rosbag, preventing buffered messages from being written and leaving a .bag.active file. I understand that this is intended and generally useful behavior, but in this case I would prefer to not escalate to SIGKILL, so that rosbag can finish writing to disk.
Is there anyway to prevent roslaunch from sending SIGKILL, either to a specific node or to any node? Alternatively, can I set the timeout before SIGKILL to a large value?