Conyinue mission on loss of RC and GNSS based on IMU

Is it possible to program px4 using mission planner in a way that it continues auto mode route before coming back despite loss of GPS and RC signals.

yes, have as look at the failsafe options in MP

Can a failsafe be programmed to terminate flight along with triggering of a powerful relay to disconnect main power supply to avoid water damage to electrical components under power?
Also can we trigger another relay to shut down engine power supply??