[execution][local] Improve handling of message handler shutdown

Relates to beat.backend.python#30
4 jobs for improve_message_handler_shutdown in 16 minutes and 5 seconds (queued for 1 second)
Status Job ID Name Coverage
  Build
passed #186657
docker-build
build_linux_36

00:13:23

64.0%
passed #186658
docker-build
build_linux_37

00:13:19

64.0%
passed #186655
macosx
build_macosx_36

00:16:00

64.0%
passed #186656
macosx
build_macosx_37

00:15:52

64.0%