Close handler after process ends

May be causing a bug where the process appears to hang