Duplicate Windows behaviour and use SendMessage for the SC_CLOSE system command instead of PostMessage.