Fixing issue where a server running in the background cannot be stopped