Fixed some test cases and a bug in texture manager
Make sure the clipboard is always properly closed and fix button layouts