new implementation of halt method

@frodsan this is the new implementation of the halt method. With this new implementation `send_file` will work, but I don't like it 100%.

What do you think?