prevent invalid calling source.close() in different threads to avoid crashes on Lollipop (#37, #29, #63, #66)