wait for py server connections to close

could be buggy, haven't finished testing yet